import { Field, Int, ObjectType } from "@nestjs/graphql";
import { BaseEntity } from "../base.entity/base.entity";
import { User } from "@prisma/client";
import { ProfileEntity } from "../profile.entity/profile.entity";
import { ClassesEntity } from "../classes.entity/classes.entity";
import { TeacherEntity } from "../teacher.entity/teacher.entity";
import { UserOnTaskEntity } from "../user.on.task.entity/user.on.task.entity";

@ObjectType()
export class UserEntity extends BaseEntity implements User {
    @Field()
    hash_key: string;

    @Field()
    account: string;

    @Field(() => Int)
    role: number;

    @Field(() => Int)
    profileId: number;

    @Field(() => ProfileEntity, { nullable: true })
    profile: ProfileEntity

    @Field({ nullable: true })
    token?: string

    @Field(() => Int, { nullable: true })
    classesId: number

    @Field(() => ClassesEntity, { nullable: true })
    classes?: ClassesEntity

    @Field(() => TeacherEntity, { nullable: true })
    Teacher?: TeacherEntity

    @Field(() => [UserOnTaskEntity], { nullable: true })
    UserOnTask?: UserOnTaskEntity[]
}
